/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package br.siagefi.service;

import br.siagefi.dao.DAO;
import br.siagefi.model.ClientePJ;
import java.util.List;

/**
 *
 * @author NOTE
 */

public class ClientePJService {
    private final DAO<ClientePJ> dao;

    public ClientePJService() {
        this.dao = new DAO<>(ClientePJ.class);
    }
    
    public void inserir(ClientePJ clientePJ){
        dao.adiciona(clientePJ);
    }
    
    public void alterar(ClientePJ clientePJ){
        dao.atualiza(clientePJ);
    }
    
    public List<ClientePJ> listar(){
        return dao.listaTodos();
    }
    
    public void remover(ClientePJ clientePJ){
        dao.remove(clientePJ);
    }
    
    public boolean jaExiste(ClientePJ clientePJ) {
        List<ClientePJ> lista = this.listar();
        for (ClientePJ c : lista) 
            if(c.equals(clientePJ))
                return true;
        return false;
    }
}
